#!/bin/bash
# qiuwei @ 2016-02-20 14:54:16

dt=`date '+%Y-%m-%d-%H-%M-%S'`
releaseDir='./release/'
tarFile=$releaseDir'release.'$dt'.tar.gz'

# 正在重新生成新版本
echo '> rebuilding'
npm run clean:prod
npm run build:prod

# 打包生成的文件
echo '> package the files'

if [ ! -d $releaseDir ]; then
    echo create a dir $releaseDir
    mkdir $releaseDir
fi

tar -cvzf $tarFile assets/dist/prod/ server/ package.json run.json changelog.md

echo '> Finish with '$tarFile

scp $tarFile root@192.168.1.49:/home/datamonitor/knowbox/
